var t = require("../../../@babel/runtime/helpers/interopRequireDefault"), a = require("../../../@babel/runtime/helpers/defineProperty"), e = t(require("../../tim-wx-sdk/tim-wx")), i = getApp(), o = 0, s = {}, n = 0, r = null, d = null, c = 0, l = null, h = null, u = null, m = "", g = 1;

Page({
    data: {
        isShowADLook: !0,
        isShowADPut: !0,
        close_reward: 0,
        close_chat: 0,
        giftEffectsTime: null,
        specialList: [],
        language: "",
        inputInfo: "",
        statusBarHeight: 0,
        navBarHeight: 0,
        showUser: !1,
        shade: !1,
        showGoodLift: !1,
        showGift: !1,
        showactivity: !1,
        showavticeFail: !1,
        mainCommentShow: !1,
        style_img: "",
        width: 60,
        height: 260,
        tipsContentHeight: 0,
        tipsContent: [],
        tipsContentMsssage: "",
        tipsopacity: 0,
        tipsopacityBol: !1,
        widthAll: 0,
        giftScreenLeft: 0,
        giftwidth: 0,
        giftScreenLeftBol: !0,
        firstwidth: "",
        activeNum: "",
        giftListContent: [],
        giftListmessage: {},
        focusBol: !0,
        giftSelectId: "",
        giftListData: "",
        giftSelectNUm: 0,
        roomData: "",
        giftMemberData: "",
        id: "",
        room_id: "",
        postData: {},
        anchorPopupData: "",
        heightauto: "auto",
        widthauto: "auto",
        screeheight: "",
        playerType: "live",
        liveListData: [],
        backid: "",
        last_room_id: "",
        last_backid: "",
        isLoadMore: !0,
        page: 1,
        total_page: 0,
        activityData: "",
        lasttime: "",
        activityTimeArray: [],
        activityDataArray: [],
        messageList: [],
        messagesTop: 0,
        view_num: 0,
        giftSelectBol: !1,
        roomMemberContent: [],
        roomMemberContentArray: [],
        roomMemberTimeArray: [],
        playBackUrl: "plugin.room.frontend.live-list.play-back",
        memberid: "",
        loadingImg: !0,
        loadingMessage: "海报生成中",
        tim: "",
        shownum: 0,
        likeNumBol: !0,
        lastGroupId: "",
        pauseBol: !0,
        catMessagebol: !0,
        wechatpayShow: !1,
        roomObj: "",
        usewechatpayBol: !1,
        moreShowBol: !1,
        memberBol: !1,
        room_ban: !1,
        explainingGoods: {
            goods_id: ""
        },
        commoditiesshow: !0,
        picturemodeshow: !0,
        imReadly: !0,
        sendMessageReadly: !0,
        SDKAppID: "",
        activityDataBtnBol: !1,
        roomMemberBtnBol: !1,
        permissionsShow: !0,
        passwordShow: !1,
        passwordVal: "",
        passwordIndex: void 0,
        IMmessage: {},
        changeAnchor: !0,
        luck_number: 0,
        showPosterWord: !1,
        diyPosterWord: "",
        oldWord: "",
        chatInputBottom: 0,
        isLivePK: !1,
        livePKData: {},
        livePKSrc: "",
        startPKTime: null,
        pkTimer: null,
        PKTimed: "00:00:00",
        mode_button: 1,
        rewardTimeOut: null,
        code_id: "",
        smallWindowIn: !1
    },
    gotoFanList: function() {
        wx.navigateTo({
            url: "/packageD/directSeeding/liveFanList/liveFanList?memberId=" + this.data.id
        });
    },
    onLoad: function(t) {
        var a = this;
        if (setTimeout(function() {
            wx.hideLoading();
        }, 1e4), setTimeout(function() {
            a.data.imReadly = !1, a.data.sendMessageReadly = !1;
        }, 5e3), this.setData({
            code_id: null
        }), t.scene) {
            var e = decodeURIComponent(t.scene);
            if (e) {
                var o = [];
                o = e.split(",");
                for (var s = 0; s < o.length; s++) {
                    var n;
                    "id" == (n = o[s].split("="))[0] ? this.setData({
                        room_id: n[1]
                    }) : "pT" == n[0] ? this.setData({
                        playerType: n[1]
                    }) : "bid" == n[0] ? this.setData({
                        backid: n[1]
                    }) : "meid" == n[0] ? this.setData({
                        memberid: n[1]
                    }) : "mid" == n[0] ? i._setMid(n[1]) : "cd" == n[0] ? this.setData({
                        code_id: n[1]
                    }) : "T" == n[0] ? 1 == n[1] ? this.setData({
                        playerType: "live"
                    }) : this.setData({
                        playerType: "video"
                    }) : "D" == n[0] && this.setData({
                        memberBol: !0
                    });
                }
            }
        } else t.mid && (i._setMid(t.mid), this.newMedia(4)), t.id && this.setData({
            room_id: t.id
        }), t.cd && this.setData({
            code_id: t.cd
        }), t.playerType && this.setData({
            playerType: t.playerType
        }), t.backid && this.setData({
            backid: t.backid
        }), t.memberid && this.setData({
            memberid: t.memberid
        });
        var r = i.globalData, d = r.statusBarHeight, c = r.navBarHeight;
        this.setData({
            statusBarHeight: d,
            navBarHeight: c
        }), this.getsdkappid(), this.newMedia(3);
    },
    permissionsShowBtn: function() {
        this.setData({
            permissionsShow: !this.data.permissionsShow
        });
    },
    passwordValInp: function(t) {
        var a = t.detail.value;
        this.setData({
            passwordVal: a
        });
    },
    commoditiesclosebtn: function() {
        this.setData({
            commoditiesshow: !1
        });
    },
    getmoreBtn: function() {
        this.setData({
            moreShowBol: !0
        });
    },
    showShoplistBtn: function(t) {
        var e = t.currentTarget.dataset.index;
        this.setData(a({}, "roomData.diy_menu[" + e + "].show", !0));
    },
    moreShowCloseBtn: function() {
        this.setData({
            moreShowBol: !1
        });
    },
    gooption: function(t) {
        var a = t.currentTarget.dataset.index, e = this.data.roomData.diy_option[a].min_url;
        if (e) try {
            wx.navigateTo({
                url: e
            });
        } catch (t) {
            wx.showToast({
                title: "链接设置错误:" + e,
                icon: "none",
                duration: 2e3
            });
        } else wx.showToast({
            title: "链接未设置",
            icon: "none",
            duration: 2e3
        });
    },
    gomenu: function(t) {
        var a = t.currentTarget.dataset.index, e = this.data.roomData.diy_menu[a].min_url;
        if (e) try {
            wx.navigateTo({
                url: e
            });
        } catch (t) {
            wx.showToast({
                title: "链接设置错误:" + e,
                icon: "none",
                duration: 2e3
            });
        } else wx.showToast({
            title: "链接未设置",
            icon: "none",
            duration: 2e3
        });
    },
    usewechatpay: function() {
        var t = this;
        if (this.data.usewechatpayBol) return !1;
        t.data.usewechatpayBol = !0;
        var a = i.getNetAddresss("finance.balance.recharge");
        if (!t.data.giftmoney) return wx.showToast({
            icon: "none",
            title: t.data.giftMemberData.credit2_name ? "充值" + t.data.giftMemberData.credit2_name + "不小于0" : "充值余额不小于0",
            duration: 1500
        }), t.setData({
            wechatpayShow: !1
        }), !1;
        a += "&client_type=2", a += "&app_type=wechat", a += "&pay_type=1", a += "&recharge_money=" + t.data.giftmoney, 
        i._getNetWork({
            url: a,
            success: function(a) {
                var e = a.data;
                if (1 == e.result) {
                    var i = e.data.config, o = {
                        timeStamp: i.timestamp,
                        nonceStr: i.nonceStr,
                        package: i.package,
                        signType: i.signType,
                        paySign: i.paySign
                    };
                    t.WXPay(o);
                } else wx.showToast({
                    icon: "none",
                    title: e.msg,
                    duration: 1500
                }), t.setData({
                    wechatpayShow: !1
                }), t.data.usewechatpayBol = !1;
            },
            fail: function(t) {
                console.log(t);
            }
        });
    },
    WXPay: function(t) {
        var a = this;
        wx.requestPayment({
            timeStamp: t.timeStamp,
            nonceStr: t.nonceStr,
            package: t.package,
            signType: t.signType ? t.signType : "MD5",
            paySign: t.paySign,
            success: function(t) {
                a.giftwechatpay(), a.data.usewechatpayBol = !1;
            },
            fail: function(t) {
                wx.showToast({
                    title: "支付失败请稍后重试",
                    icon: "none",
                    duration: 2e3,
                    success: function() {},
                    fail: function() {}
                }), a.data.usewechatpayBol = !1;
            }
        });
    },
    wechatpayShowCloseBtn: function() {
        this.setData({
            wechatpayShow: !1
        });
    },
    giftwechatpay: function() {
        var t = this, a = i.getNetAddresss("plugin.room.frontend.reward.index");
        i._postNetWork({
            url: a,
            showToastIn: !1,
            data: {
                reward_type: this.data.activeNum,
                room_id: this.data.room_id,
                reward_id: this.data.giftSelectId,
                number: this.data.giftmoney
            },
            success: function(a) {
                var e = a.data;
                1 == e.result ? (wx.showToast({
                    icon: "none",
                    title: "打赏成功",
                    duration: 1500
                }), t.setData({
                    wechatpayShow: !1
                })) : wx.showToast({
                    icon: "none",
                    title: e.msg,
                    duration: 1500
                }), t.data.giftSelectBol = !1;
            },
            fail: function(t) {
                console.log(t.msg);
            }
        });
    },
    getmemberid: function() {
        var t = this, a = i.getNetAddresss("plugin.room.frontend.anchor.get-member-id");
        i._postNetWork({
            url: a,
            showToastIn: !1,
            data: {
                room_id: this.data.room_id
            },
            success: function(a) {
                var e = a.data;
                1 == e.result ? (t.setData({
                    memberid: e.data.member_id
                }), t.getplayBack()) : wx.showToast({
                    icon: "none",
                    title: e.msg,
                    duration: 1500
                });
            },
            fail: function(t) {
                console.log(t.msg);
            }
        });
    },
    getsdkappid: function() {
        var t = this, a = i.getNetAddresss("plugin.room.frontend.im.get-im-sdk");
        i._postNetWork({
            url: a,
            showToastIn: !1,
            data: {},
            success: function(a) {
                var i = a.data;
                if (1 == i.result) {
                    var o = {
                        SDKAppID: i.data.sdkappid
                    };
                    i.data.sdkappid && (t.data.SDKAppID = i.data.sdkappid), t.data.tim = e.default.create(o), 
                    t.data.tim.setLogLevel(0), t.chatEventList(), "live" == t.data.playerType ? (wx.showLoading({
                        title: "直播加载中..."
                    }), t.data.roomObj = wx.createLivePlayerContext("liveid_" + t.data.room_id), t.getLiveList()) : "video" == t.data.playerType && (t.data.memberid || t.data.memberBol ? (t.data.playBackUrl = "plugin.room.frontend.anchor.get-back", 
                    t.data.memberid ? t.getplayBack() : t.getmemberid()) : t.getplayBack()), t.getinformation(), 
                    t.getMyCanvasMessage(), l = wx.createCanvasContext("bubble"), t.getTipsContent();
                } else wx.showToast({
                    icon: "none",
                    title: i.msg,
                    duration: 1500
                });
            },
            fail: function(t) {
                console.log(t.msg);
            }
        });
    },
    setGoods: function(t) {
        var a = t.currentTarget.dataset.id;
        wx.navigateTo({
            url: "/packageA/detail_v2/detail_v2?id=" + a + "&liveshow=1&roomid=" + this.data.room_id
        });
    },
    comeRoom: function() {
        1 == this.data.IMmessage.come && this.catComeMessage(), 1 == this.data.IMmessage.welcome && this.catWelcomeMessage();
    },
    catComeMessage: function() {
        var t, a = this, i = {
            memberId: this.data.roomData.userID ? this.data.roomData.userID : "",
            nickname: this.data.roomData.userNickname ? this.data.roomData.userNickname : "",
            memberAvatar: this.data.roomData.userAvatar ? this.data.roomData.userAvatar : ""
        };
        t = {
            to: a.data.roomData.groupId,
            conversationType: e.default.TYPES.CONV_GROUP,
            payload: {
                data: "自定义文本",
                description: JSON.stringify(i),
                extension: "come"
            }
        };
        var o = a.data.tim.createCustomMessage(t), s = a.data.tim.sendMessage(o), n = a.data.tipsContent;
        s.then(function(t) {
            n.push({
                type: "come",
                nickname: i.nickname
            }), a.data.tipsContent = n, console.log("xx进入直播间提示成功：：：");
        }).catch(function(t) {
            wx.showToast({
                icon: "none",
                title: "进入直播间提示失败:::" + t,
                duration: 1200
            }), console.warn("sendMessage error:", t);
        });
    },
    catWelcomeMessage: function() {
        var t, a = this, i = {
            content: this.data.IMmessage.welcome_content
        };
        t = {
            to: a.data.roomData.groupId,
            conversationType: e.default.TYPES.CONV_GROUP,
            payload: {
                data: "自定义文本",
                description: JSON.stringify(i),
                extension: "welcome"
            }
        };
        var o = a.data.tim.createCustomMessage(t), s = a.data.tim.sendMessage(o), n = a.data.messageList;
        s.then(function(t) {
            n.push({
                content: i.content
            }), a.setData({
                messageList: n,
                messagesTop: 1e3 * n.length
            }), console.log("进入直播间自动回复成功提示：：：");
        }).catch(function(t) {
            wx.showToast({
                icon: "none",
                title: "进入直播间自动回复提示失败:::" + t,
                duration: 1200
            }), console.warn("sendMessage error:", t);
        });
    },
    activeRoomSet: function() {
        if (this.data.IMmessage) {
            if (this.data.IMmessage.now_goods && this.data.IMmessage.now_goods.goods_id && this.setData({
                explainingGoods: this.data.IMmessage.now_goods
            }), 1 == this.data.IMmessage.room_ban) return this.setData({
                picturemodeshow: !1
            }), void wx.showModal({
                title: "提示",
                content: "您已被禁入直播间",
                showCancel: !1,
                success: function(t) {
                    t.confirm && wx.redirectTo({
                        url: "/packageD/directSeeding/liveList/liveList"
                    });
                }
            });
            if (1 == this.data.IMmessage.chat_ban) return wx.showModal({
                title: "提示",
                content: "您已经被禁言",
                showCancel: !1,
                success: function(t) {}
            }), void this.setData({
                room_ban: !0
            });
        }
    },
    getLiveList: function() {
        var t = this, a = i.getNetAddresss("plugin.room.frontend.live-list.get-live-list");
        i._postNetWork({
            url: a,
            showToastIn: !1,
            data: {
                status: 3,
                page: 1
            },
            success: function(a) {
                var e = a.data;
                if (1 == e.result) {
                    t.setData({
                        total_page: e.data.last_page
                    });
                    var i = e.data.data, o = [ {
                        id: t.data.room_id,
                        changeloadBol: !1
                    } ];
                    i.length > 0 ? (i.forEach(function(a) {
                        a.id != t.data.room_id && o.push({
                            id: a.id,
                            avatar: a.avatar,
                            banner: a.banner,
                            cover: a.cover,
                            changeloadBol: !1
                        });
                    }), t.setData({
                        liveListData: o,
                        last_room_id: t.data.room_id
                    })) : t.setData({
                        liveListData: [ {
                            id: t.data.room_id
                        } ],
                        last_room_id: t.data.room_id
                    }), t.getData(0), t.getPoster();
                } else wx.showToast({
                    icon: "none",
                    title: e.msg,
                    duration: 1500
                });
            },
            fail: function(t) {
                console.log(t.msg);
            }
        });
    },
    getplayBack: function() {
        var t = this, a = i.getNetAddresss(t.data.playBackUrl), e = {};
        e = this.data.memberid ? {
            member_id: this.data.memberid,
            page: 1
        } : {
            page: 1
        }, i._postNetWork({
            url: a,
            showToastIn: !1,
            data: e,
            success: function(a) {
                var e = a.data;
                if (1 == e.result) {
                    t.setData({
                        total_page: e.data.last_page
                    });
                    var i = e.data.data, o = [ {
                        id: t.data.room_id,
                        backid: t.data.backid,
                        changeloadBol: !1
                    } ];
                    i.length > 0 ? (i.forEach(function(a) {
                        a.id != t.data.backid && o.push({
                            id: a.room_id,
                            backid: a.id,
                            avatar: a.avatar,
                            banner: a.banner,
                            cover: a.cover,
                            changeloadBol: !1
                        });
                    }), t.setData({
                        liveListData: o,
                        last_backid: t.data.backid
                    })) : t.setData({
                        liveListData: [ {
                            id: t.data.room_id,
                            backid: t.data.backid
                        } ],
                        last_backid: t.data.backid
                    }), t.getBackData(0), t.getPoster();
                } else wx.showToast({
                    icon: "none",
                    title: e.msg,
                    duration: 1500
                });
            },
            fail: function(t) {
                console.log(t.msg);
            }
        });
    },
    liveChange: function(t) {
        this.data.rewardTimeOut = null, clearInterval(this.data.rewardTimeOut);
        var e = t.detail.current;
        console.log(e), this.quitGroup();
        this.setData({
            loadingImg: !0,
            loadingMessage: "海报生成中"
        }), e == this.data.liveListData.length - 2 && this.getMoreData();
        for (var i = 0; i < this.data.liveListData.length; i++) this.setData(a({}, "liveListData[" + i + "].changeloadBol", !1));
        "live" == this.data.playerType ? (this.setData({
            room_id: this.data.liveListData[e].id,
            changeAnchor: !0,
            isLivePK: !1,
            livePKData: {}
        }), this.getData(e), this.getPoster(), this.data.roomObj = wx.createLivePlayerContext("liveid_" + this.data.room_id), 
        this.data.pkTimer && (clearInterval(this.data.pkTimer), this.data.pkTimer = null)) : (this.setData({
            room_id: this.data.liveListData[e].id,
            backid: this.data.liveListData[e].backid,
            changeAnchor: !0
        }), this.getBackData(e), this.getPoster()), this.setData({
            messageList: [],
            messagesTop: 0
        }), this.data.tipsContent = [], this.data.giftListContent = [], this.setData({
            tipsContentMsssage: "",
            giftListmessage: {}
        }), this.data.catMessagebol = !0, this.setData({
            likeNumBol: !0
        });
    },
    getBackData: function(t) {
        var e = this, o = i.getNetAddresss("plugin.room.frontend.live.room-back");
        i._postNetWork({
            url: o,
            showToastIn: !1,
            data: {
                room_id: this.data.room_id,
                back_id: this.data.backid
            },
            success: function(i) {
                var o = i.data;
                1 == o.result ? (console.log(o.data), e.setData({
                    shownum: o.data.like_num ? o.data.like_num : 0,
                    roomData: o.data,
                    id: o.data.member_id,
                    view_num: o.data.view_num,
                    IMmessage: o.data.message,
                    luck_number: o.data.luck_number || 0,
                    close_reward: o.data.close_reward || 0,
                    close_chat: o.data.close_chat || 0,
                    mode_button: o.data.mode_button || 0
                }), 1 == o.data.is_concern ? e.setData({
                    focusBol: !1
                }) : e.setData({
                    focusBol: !0
                }), e.activeRoomSet(), 1 == o.data.IM && setTimeout(function() {
                    e.chatLogin();
                }, 1e3), e.data.last_backid == e.data.backid && e.setData({
                    "liveListData[0].avatar": o.data.avatar,
                    "liveListData[0].cover": o.data.cover,
                    "liveListData[0].banner": o.data.banner
                }), void 0 !== t && e.setData(a({}, "liveListData[" + t + "].changeloadBol", !0)), 
                clearTimeout(n), clearTimeout(r), clearTimeout(d), e.getGiftEffect()) : wx.showToast({
                    icon: "none",
                    title: o.msg,
                    duration: 1500
                });
            },
            fail: function(t) {
                console.log(t.msg);
            }
        });
    },
    getMoreData: function() {
        var t = this, a = {}, e = "", o = "";
        t.data.isLoadMore = !1, this.data.page >= this.data.total_page || (this.data.page = this.data.page + 1, 
        "live" == this.data.playerType ? (e = "plugin.room.frontend.live-list.get-live-list", 
        a = {
            status: 3,
            page: this.data.page
        }) : (e = t.data.playBackUrl, a = this.data.memberid ? {
            member_id: this.data.memberid,
            page: this.data.page
        } : {
            page: this.data.page
        }), o = i.getNetAddresss(e), i._postNetWork({
            url: o,
            showToastIn: !1,
            data: a,
            success: function(a) {
                var e = a.data;
                if (1 == e.result) if ("live" == t.data.playerType) {
                    var i = e.data.data, o = t.data.liveListData;
                    i.length > 0 && (i.forEach(function(a) {
                        a.id != t.data.last_room_id && o.push({
                            id: a.id,
                            avatar: a.avatar,
                            banner: a.banner,
                            cover: a.cover,
                            changeloadBol: !1
                        });
                    }), t.setData({
                        liveListData: o
                    }));
                } else {
                    var s = e.data.data, n = t.data.liveListData;
                    s.length > 0 && (s.forEach(function(a) {
                        a.id != t.data.last_backid && n.push({
                            id: a.room_id,
                            backid: a.id,
                            avatar: a.avatar,
                            banner: a.banner,
                            changeloadBol: !1
                        });
                    }), t.setData({
                        liveListData: n
                    }));
                } else t.setData({
                    page: t.data.page - 1,
                    isLoadMore: !1
                });
            },
            fail: function(t) {
                console.log(t.msg);
            }
        }));
    },
    getinformation: function() {
        try {
            var t = wx.getSystemInfoSync(), a = t.windowHeight, e = t.windowWidth;
            this.setData({
                heightauto: a + "px",
                widthauto: e + "px"
            }), this.data.screeheight = a;
        } catch (t) {}
    },
    getTipsContent: function() {
        this.startMove();
    },
    getGiftEffect: function() {
        var t = this, a = wx.createSelectorQuery();
        a.selectAll("#gift_screen .li").boundingClientRect(), a.selectViewport().scrollOffset(), 
        a.exec(function(a) {
            var e = 0, i = a[0] ? a[0] : [];
            i.forEach(function(t, a) {
                e += t.width;
            }), t.data.firstwidth = i[0].width;
            var o = wx.createSelectorQuery();
            o.select("#gift_screen").boundingClientRect(), o.selectViewport().scrollOffset(), 
            o.exec(function(a) {
                var i = a[0].width;
                t.setData({
                    giftwidth: i,
                    widthAll: e < i ? i : e,
                    giftScreenLeft: i
                }), d = setTimeout(function() {
                    t.setData({
                        giftScreenLeftBol: !1
                    }), t.giftListRoll();
                }, 1e3);
            });
        });
    },
    getMyCanvasMessage: function() {
        var t = this;
        wx.getSystemInfo({
            success: function(a) {
                g = wx.getSystemInfoSync().pixelRatio, m = 2 * a.windowWidth < 750 ? a.windowWidth / 620 : a.windowWidth / 750, 
                h = 620 * g * m, u = 883 * g * m, t.setData({
                    canvasWidth: parseInt(h),
                    canvasHeight: parseInt(u)
                });
            }
        });
    },
    getAnchorPopup: function() {
        0 == o && (o = 1, setTimeout(function() {
            o = 0;
        }, 2e3)), wx.showLoading({
            title: "加载中"
        });
        var t = this, a = i.getNetAddresss("plugin.room.frontend.live.anchor-popup");
        i._postNetWork({
            url: a,
            showToastIn: !1,
            data: {
                room_id: this.data.room_id
            },
            success: function(a) {
                wx.hideLoading();
                var e = a.data;
                1 == e.result ? (t.setData({
                    anchorPopupData: e.data,
                    changeAnchor: !1
                }), 1 == e.data.is_concern ? t.setData({
                    focusBol: !1
                }) : t.setData({
                    focusBol: !0
                }), t.setData({
                    showUser: !0,
                    shade: !0
                })) : wx.showToast({
                    icon: "none",
                    title: e.msg,
                    duration: 1500
                });
            },
            fail: function(t) {
                wx.hideLoading(), console.log(t.msg);
            }
        });
    },
    downImg: function() {
        var t = this;
        this.data.postData.avatar && wx.downloadFile({
            url: this.data.postData.avatar,
            success: function(a) {
                t.setData({
                    "postData.avatar": a.tempFilePath
                }), t.data.postData.cover && wx.downloadFile({
                    url: t.data.postData.cover,
                    success: function(a) {
                        t.setData({
                            "postData.cover": a.tempFilePath
                        }), wx.getImageInfo({
                            src: t.data.postData.cover,
                            success: function(a) {
                                t.setData({
                                    "postData.imgData": a
                                }), t.data.postData.m_avatar && wx.downloadFile({
                                    url: t.data.postData.m_avatar,
                                    success: function(a) {
                                        t.setData({
                                            "postData.m_avatar": a.tempFilePath
                                        }), t.data.postData.qr_code && wx.downloadFile({
                                            url: t.data.postData.qr_code,
                                            success: function(a) {
                                                t.setData({
                                                    "postData.qr_code": a.tempFilePath
                                                }), t.data.postData.shop_logo ? wx.downloadFile({
                                                    url: t.data.postData.shop_logo,
                                                    success: function(a) {
                                                        t.setData({
                                                            "postData.shop_logo": a.tempFilePath
                                                        }), 1 != t.data.roomData.is_share_word && t.getAvaterInfo();
                                                    },
                                                    fail: function(a) {
                                                        t.setData({
                                                            loadingMessage: "海报生成失败，商城图标下载失败"
                                                        }), console.log(a, "失败");
                                                    }
                                                }) : (t.setData({
                                                    "postData.shop_logo": ""
                                                }), 1 != t.data.roomData.is_share_word && t.getAvaterInfo());
                                            },
                                            fail: function(a) {
                                                console.log(a, "失败"), t.setData({
                                                    loadingMessage: "海报生成失败，小程序二维码下载失败"
                                                });
                                            }
                                        });
                                    },
                                    fail: function(a) {
                                        t.setData({
                                            loadingMessage: "海报生成失败，用户头像图片下载失败"
                                        }), console.log(a, "失败");
                                    }
                                });
                            }
                        });
                    },
                    fail: function(a) {
                        t.setData({
                            loadingMessage: "海报生成失败，直播封面图片下载失败"
                        }), console.log(a, "失败");
                    }
                });
            },
            fail: function(a) {
                t.setData({
                    loadingMessage: "海报生成失败，主播头像图片下载失败"
                }), console.log(a, "失败");
            }
        });
    },
    getPoster: function() {
        var t = this, a = i.getNetAddresss("plugin.room.frontend.live-list.room-post"), e = {};
        t.data.room_id && (e.id = this.data.room_id), t.data.playerType && (e.playerType = this.data.playerType), 
        t.data.backid && (e.backid = this.data.backid), t.data.memberid && (e.memberid = this.data.memberid), 
        i._postNetWork({
            url: a,
            showToastIn: !1,
            data: e,
            success: function(a) {
                var e = a.data;
                1 == e.result ? (t.setData({
                    postData: e.data
                }), t.downImg()) : wx.showToast({
                    icon: "none",
                    title: e.msg,
                    duration: 1500
                });
            },
            fail: function(t) {
                console.log(t.msg);
            }
        });
    },
    smallWindowClose1: function() {
        this.data.smallWindowIn = !0;
    },
    smallWindowClose: function() {
        this.data.smallWindowIn = !1;
    },
    statechange: function(t) {
        var a = this, e = t.detail.code;
        "2004" == e && this.data.code_id && (this.data.rewardTimeOut || (this.data.rewardTimeOut = setInterval(function() {
            a.rewardLive();
        }, 6e4))), "2006" == e && this.data.code_id && (this.data.isLivePK || (this.data.rewardTimeOut = null, 
        clearInterval(this.data.rewardTimeOut))), "2002" != e && "2002" != e || wx.hideLoading({});
    },
    rewardLive: function() {
        var t = i.getNetAddresss("plugin.room.frontend.live.room-view");
        i._postNetWork({
            url: t,
            showToastIn: !1,
            data: {
                code_id: this.data.code_id,
                room_id: this.data.room_id
            },
            success: function(t) {
                1 == t.data.result && console.log("成功");
            },
            fail: function(t) {
                console.log(t.msg);
            }
        });
    },
    error: function(t) {
        this.data.rewardTimeOut = null, clearInterval(this.data.rewardTimeOut), wx.hideLoading({}), 
        wx.showModal({
            title: "提示",
            content: "错误提示" + t.detail.errMsg + "(返回直播列表)",
            success: function(t) {
                t.confirm && wx.redirectTo({
                    url: "/packageD/directSeeding/liveList/liveList"
                });
            }
        }), console.log("kkkk:::", t);
    },
    statechangePK: function(t) {
        var a = this, e = t.detail.code;
        "2004" == e && this.data.code_id && (this.data.rewardTimeOut || (this.data.rewardTimeOut = setInterval(function() {
            a.rewardLive();
        }, 6e4))), "2002" != e && "2002" != e || wx.hideLoading({});
    },
    errorPK: function(t) {
        this.data.rewardTimeOut = null, clearInterval(this.data.rewardTimeOut), wx.hideLoading({}), 
        wx.showToast({
            title: "拉取连麦失败",
            icon: "success",
            duration: 2e3
        }), console.log("拉取连麦失败:::", t);
    },
    quitGroup: function() {
        this.data.lastGroupId && this.data.tim.quitGroup(this.data.lastGroupId).then(function(t) {
            console.log(t.data.groupID);
        }).catch(function(t) {
            console.warn("quitGroup error:", t);
        });
        clearTimeout(this.data.giftEffectsTime);
    },
    chatJoinGroup: function() {
        var t = this;
        t.data.lastGroupId = t.data.roomData.groupId, t.data.tim.joinGroup({
            groupID: t.data.roomData.groupId,
            type: e.default.TYPES.GRP_CHATROOM
        }).then(function(a) {
            switch (a.data.status) {
              case e.default.TYPES.JOIN_STATUS_WAIT_APPROVAL:
                break;

              case e.default.TYPES.JOIN_STATUS_SUCCESS:
                console.log(a.data.group);
            }
            t.comeRoom(), t.data.imReadly = !1;
        }).catch(function(a) {
            t.comeRoom(), t.data.imReadly = !1, console.warn("joinGroup error:", a);
        });
    },
    chatMyProfile: function() {
        var t = this;
        t.data.tim.getMyProfile().then(function(a) {
            console.log(a.data), a.data.nick || t.changeMyProfile();
        }).catch(function(t) {
            console.warn("getMyProfile error:", t);
        });
    },
    changeMyProfile: function() {
        this.data.tim.updateMyProfile({
            nick: this.data.roomData.userNickname,
            avatar: this.data.roomData.userAvatar
        }).then(function(t) {
            console.log(t.data);
        }).catch(function(t) {
            console.warn("updateMyProfile error:", t);
        });
    },
    activityDataBtn: function(t) {
        if (this.data.activityDataBtnBol) return !1;
        this.data.activityDataBtnBol = !0;
        var e = t.currentTarget.dataset.id, o = t.currentTarget.dataset.index;
        if (2 == this.data.activityDataArray[o].activityData.status) return !1;
        var s = this, n = i.getNetAddresss("plugin.room.frontend.live.member-activity");
        i._postNetWork({
            url: n,
            showToastIn: !1,
            data: {
                room_id: this.data.room_id,
                activity_id: e
            },
            success: function(t) {
                var e = t.data;
                if (1 == e.result) {
                    wx.showToast({
                        icon: "none",
                        title: e.msg,
                        duration: 1500
                    });
                    var i = e.data;
                    1 == i.balanceBonus ? s.setData(a({}, "activityDataArray[" + o + "].activityData.balanceBonusStatus", 2)) : s.setData(a({}, "activityDataArray[" + o + "].activityData.balanceBonusStatus", 3));
                    var n = s.data.activityDataArray[o].activityData.activityList;
                    1 == i.coupon ? (n.forEach(function(t, a) {
                        n[a].status = 2;
                    }), s.setData(a({}, "activityDataArray[" + o + "].activityData.activityList", n))) : (n.forEach(function(t, a) {
                        n[a].status = 3;
                    }), s.setData(a({}, "activityDataArray[" + o + "].activityData.activityList", n))), 
                    1 == i.loveBonus ? s.setData(a({}, "activityDataArray[" + o + "].activityData.loveBonusStatus", 2)) : s.setData(a({}, "activityDataArray[" + o + "].activityData.loveBonusStatus", 3)), 
                    1 == i.packetBonus ? s.setData(a({}, "activityDataArray[" + o + "].activityData.packetBonusStatus", 2)) : s.setData(a({}, "activityDataArray[" + o + "].activityData.packetBonusStatus", 3)), 
                    1 == i.pointBonus ? s.setData(a({}, "activityDataArray[" + o + "].activityData.pointBonusStatus", 2)) : s.setData(a({}, "activityDataArray[" + o + "].activityData.pointBonusStatus", 3)), 
                    s.setData(a({}, "activityDataArray[" + o + "].activityData.status", 2)), s.data.activityDataBtnBol = !1;
                } else s.data.activityDataBtnBol = !1, wx.showToast({
                    icon: "none",
                    title: e.msg,
                    duration: 1500
                });
            },
            fail: function(t) {
                console.log(t.msg);
            }
        });
    },
    chatEventList: function() {
        var t = this;
        t.data.tim.on(e.default.EVENT.SDK_READY, function(a) {
            t.data.sendMessageReadly = !1, t.chatMyProfile();
        }), t.data.tim.on(e.default.EVENT.MESSAGE_RECEIVED, function(a) {
            if ("TIMCustomElem" == a.data[0].type && a.data[0].payload && "customText" == a.data[0].payload.extension) {
                if (t.data.lasttime == a.data[0].time) return;
                t.data.lasttime = a.data[0].time;
            }
            var i = a.data, o = t.data.tipsContent, s = t.data.giftListContent, n = t.data.roomMemberContent;
            i.forEach(function(a, i) {
                if (a.conversationType == e.default.TYPES.CONV_GROUP) {
                    var r = a;
                    if ("administrator" == r.from) if ("end" == r.payload.extension) wx.showModal({
                        title: "提示",
                        content: "直播已经结束",
                        showCancel: !1,
                        success: function(t) {
                            t.confirm && wx.redirectTo({
                                url: "/packageD/directSeeding/liveList/liveList"
                            });
                        }
                    }); else if ("explain_goods" == r.payload.extension) {
                        if (r.payload.description) {
                            var d = JSON.parse(r.payload.description);
                            t.setData({
                                explainingGoods: d
                            });
                        }
                    } else if ("cancel_explain" == r.payload.extension) t.setData({
                        "explainingGoods.goods_id": ""
                    }); else if ("chat_reply" == r.payload.extension) {
                        if (r.payload.description) {
                            var c = JSON.parse(r.payload.description).member_id;
                            t.data.roomData.userID == c && (wx.showModal({
                                title: "提示",
                                content: "您已经解除禁言",
                                showCancel: !1,
                                success: function(t) {}
                            }), t.setData({
                                room_ban: !1
                            }));
                        }
                    } else if ("chat_ban" == r.payload.extension) {
                        if (r.payload.description) {
                            var l = JSON.parse(r.payload.description).member_id;
                            t.data.roomData.userID == l && (wx.showModal({
                                title: "提示",
                                content: "您已经被禁言",
                                showCancel: !1,
                                success: function(t) {}
                            }), t.setData({
                                room_ban: !0
                            }));
                        }
                    } else if ("room_ban" == r.payload.extension) {
                        if (r.payload.description) {
                            var h = JSON.parse(r.payload.description).member_id;
                            t.data.roomData.userID == h && (t.setData({
                                picturemodeshow: !1
                            }), wx.showModal({
                                title: "提示",
                                content: "您已被禁入直播间",
                                showCancel: !1,
                                success: function(t) {
                                    t.confirm && wx.redirectTo({
                                        url: "/packageD/directSeeding/liveList/liveList"
                                    });
                                }
                            }));
                        }
                    } else if ("ban" == r.payload.extension) wx.showModal({
                        title: "提示",
                        content: "直播已经封禁",
                        showCancel: !1,
                        success: function(t) {
                            t.confirm && wx.redirectTo({
                                url: "/packageD/directSeeding/liveList/liveList"
                            });
                        }
                    }); else if ("welcome" == r.payload.extension) ; else if ("leave" == r.payload.extension) wx.showModal({
                        title: "提示",
                        content: "主播暂时离开",
                        showCancel: !1,
                        success: function(t) {}
                    }); else if ("online" == r.payload.extension) wx.showModal({
                        title: "提示",
                        content: "主播重新连接",
                        showCancel: !1,
                        success: function(a) {
                            a.confirm && t.data.roomObj.play({
                                success: function() {
                                    wx.showToast({
                                        icon: "none",
                                        title: "正在重新启动播放",
                                        duration: 1500
                                    });
                                },
                                fail: function() {
                                    wx.showToast({
                                        icon: "none",
                                        title: "重新启动播放失败",
                                        duration: 1500
                                    });
                                }
                            });
                        }
                    }); else if ("reward" == r.payload.extension) {
                        if (r.payload.description) {
                            var u = JSON.parse(r.payload.description);
                            if (1 == u.show_effect) {
                                var m = t.data.specialList;
                                m.push({
                                    nickname: u.nickname,
                                    reward_name: "送主播" + u.reward_name,
                                    img: u.avatar,
                                    effect_time: u.effect_time,
                                    effect_type: u.effect_type,
                                    effect_gif: "".concat(u.effect_gif, "?v=").concat(Date.now())
                                }), t.setData({
                                    specialList: m
                                }), t.data.specialList.length <= 1 && t.giftEffectsTimer();
                            } else s.push({
                                nickname: u.nickname,
                                avatar: u.avatar,
                                reward_name: "送主播" + u.reward_name,
                                reward_icon: u.reward_icon
                            }), t.data.giftListContent = s;
                        }
                    } else if ("virtual_view_num" == r.payload.extension) {
                        if (r.payload.description) {
                            var g = JSON.parse(r.payload.description);
                            console.log(g), t.setData({
                                view_num: g.view_num
                            });
                        }
                    } else if ("concern" == r.payload.extension) {
                        if (r.payload.description) {
                            var f = JSON.parse(r.payload.description);
                            o.push({
                                type: "concern",
                                nickname: f.nickname
                            }), t.data.tipsContent = o;
                        }
                    } else if ("buy" == r.payload.extension) {
                        if (r.payload.description) {
                            var p = JSON.parse(r.payload.description);
                            o.push({
                                type: "buy",
                                nickname: p.nickname,
                                count: p.count
                            }), t.data.tipsContent = o;
                        }
                    } else if ("come" == r.payload.extension) ; else if ("room_member" == r.payload.extension) {
                        if (r.payload.description) {
                            var v = JSON.parse(r.payload.description);
                            n.push(v), t.data.roomMemberContent = n;
                        }
                        t.getroomMember(t.data.roomMemberContent.length - 1);
                    } else "TIMCustomElem" == r.type && ("open_chat" == r.payload.extension ? t.setData({
                        close_chat: 0
                    }) : "close_chat" == r.payload.extension ? t.setData({
                        close_chat: 1
                    }) : "open_reward" == r.payload.extension ? t.setData({
                        close_reward: 0
                    }) : "close_reward" == r.payload.extension && t.setData({
                        close_reward: 1
                    })); else if ("TIMTextElem" == r.type) ; else if ("TIMCustomElem" == r.type) if (console.log("有信息了======", JSON.parse(r.payload.description)), 
                    "customPkGroup" == r.payload.extension) t.data.startPKTime = Date.parse(new Date()) / 1e3, 
                    t.data.pkTimer = setInterval(function() {
                        t.GetRTime();
                    }, 1e3), t.setData({
                        livePKData: JSON.parse(r.payload.description),
                        livePKSrc: t.data.roomData.play_url_rtmp.match(/(\S*)\/live\//)[1] + "/live/" + JSON.parse(r.payload.description).streamid,
                        isLivePK: !0
                    }); else if ("customQuitPkGroup" == r.payload.extension) t.setData({
                        livePKData: {},
                        livePKSrc: "",
                        isLivePK: !1,
                        PKTimed: "00:00:00"
                    }), clearInterval(t.data.pkTimer); else if ("customText" == r.payload.extension) {
                        var w = t.data.messageList, D = JSON.parse(r.payload.description);
                        D && D.memberLevelName && (D.memberLevelName = D.memberLevelName.substr(0, 2)), 
                        w.push(D), t.setData({
                            messageList: w,
                            messagesTop: 1e3 * w.length
                        });
                    } else if ("come" == r.payload.extension) {
                        if (r.payload.description) {
                            var y = JSON.parse(r.payload.description);
                            o.push({
                                type: "come",
                                nickname: y.nickname
                            }), t.data.tipsContent = o;
                        }
                    } else if ("welcome" == r.payload.extension && r.payload.description) {
                        var _ = JSON.parse(r.payload.description), T = t.data.messageList;
                        T.push({
                            content: _.content
                        }), t.setData({
                            messageList: T,
                            messagesTop: 1e3 * T.length
                        });
                    }
                }
            });
        }), t.data.tim.on(e.default.EVENT.MESSAGE_REVOKED, function(t) {}), t.data.tim.on(e.default.EVENT.CONVERSATION_LIST_UPDATED, function(t) {}), 
        t.data.tim.on(e.default.EVENT.GROUP_LIST_UPDATED, function(t) {}), t.data.tim.on(e.default.EVENT.GROUP_SYSTEM_NOTICE_RECEIVED, function(t) {}), 
        t.data.tim.on(e.default.EVENT.PROFILE_UPDATED, function(t) {}), t.data.tim.on(e.default.EVENT.BLACKLIST_UPDATED, function(t) {}), 
        t.data.tim.on(e.default.EVENT.ERROR, function(t) {}), t.data.tim.on(e.default.EVENT.SDK_NOT_READY, function(t) {}), 
        t.data.tim.on(e.default.EVENT.KICKED_OUT, function(t) {
            wx.showToast({
                icon: "none",
                title: "您的IM被踢下线了",
                duration: 2e3
            });
        });
    },
    roomMemberBtn: function(t) {
        if (this.data.roomMemberBtnBol) return !1;
        this.data.roomMemberBtnBol = !0;
        var e = t.currentTarget.dataset.id, o = t.currentTarget.dataset.index;
        if (2 == this.data.roomMemberContentArray[o].activityData.status) return !1;
        var s = this, n = i.getNetAddresss("plugin.room.frontend.live.room-member-activity");
        i._postNetWork({
            url: n,
            showToastIn: !1,
            data: {
                room_id: this.data.room_id,
                activity_id: e
            },
            success: function(t) {
                var e = t.data;
                if (1 == e.result) {
                    wx.showToast({
                        icon: "none",
                        title: e.msg,
                        duration: 1500
                    });
                    var i = e.data;
                    1 == i.balanceBonus ? s.setData(a({}, "roomMemberContentArray[" + o + "].activityData.balanceBonusStatus", 2)) : s.setData(a({}, "roomMemberContentArray[" + o + "].activityData.balanceBonusStatus", 3));
                    var n = s.data.roomMemberContentArray[o].activityData.activityList;
                    1 == i.coupon ? (n.forEach(function(t, a) {
                        n[a].status = 2;
                    }), s.setData(a({}, "roomMemberContentArray[" + o + "].activityData.activityList", n))) : (n.forEach(function(t, a) {
                        n[a].status = 3;
                    }), s.setData(a({}, "roomMemberContentArray[" + o + "].activityData.activityList", n))), 
                    1 == i.loveBonus ? s.setData(a({}, "roomMemberContentArray[" + o + "].activityData.loveBonusStatus", 2)) : s.setData(a({}, "roomMemberContentArray[" + o + "].activityData.loveBonusStatus", 3)), 
                    1 == i.packetBonus ? s.setData(a({}, "roomMemberContentArray[" + o + "].activityData.packetBonusStatus", 2)) : s.setData(a({}, "roomMemberContentArray[" + o + "].activityData.packetBonusStatus", 3)), 
                    1 == i.pointBonus ? s.setData(a({}, "roomMemberContentArray[" + o + "].activityData.pointBonusStatus", 2)) : s.setData(a({}, "roomMemberContentArray[" + o + "].activityData.pointBonusStatus", 3)), 
                    s.setData(a({}, "roomMemberContentArray[" + o + "].activityData.status", 2)), s.data.roomMemberBtnBol = !1;
                } else s.data.roomMemberBtnBol = !1, wx.showToast({
                    icon: "none",
                    title: e.msg,
                    duration: 1500
                });
            },
            fail: function(t) {
                console.log(t.msg);
            }
        });
    },
    getroomMember: function(t) {
        var e = this.data.roomMemberContent[t], i = this.data.roomMemberContentArray;
        if (e) {
            var o = e, s = [];
            o.coupon && o.coupon.coupon_id && o.coupon.coupon_id.forEach(function(t, a) {
                s.push({
                    coupon_id: o.coupon.coupon_id[a],
                    coupon_name: o.coupon.coupon_name[a],
                    coupon_several: o.coupon.coupon_several[a],
                    status: 1
                });
            }), o.activityList = s, o.pointBonusStatus = 1, o.loveBonusStatus = 1, o.balanceBonusStatus = 1, 
            o.packetBonusStatus = 1, o.status = 1, o.showactivity = !1, i.push({
                activityData: o
            }), this.setData({
                roomMemberContentArray: i
            }), this.setData(a({}, "roomMemberContentArray[" + t + "].activityData.showactivity", !0));
        }
    },
    logout: function() {
        this.data.tim.logout().then(function(t) {
            console.log(t.data);
        }).catch(function(t) {
            console.warn("logout error:", t);
        });
    },
    chatLogin: function() {
        var t = this;
        t.data.tim.login({
            userID: t.data.roomData.userID.toString(),
            userSig: t.data.roomData.userSig
        }).then(function(a) {
            console.log(a.data), t.chatJoinGroup();
        }).catch(function(t) {
            console.warn("login error:", t);
        });
    },
    getGiftList: function() {
        wx.showLoading({
            title: "加载中"
        });
        var t = this, a = i.getNetAddresss("plugin.room.frontend.live.reward-list");
        i._postNetWork({
            url: a,
            showToastIn: !1,
            data: {},
            success: function(a) {
                var e = a.data;
                if (1 == e.result) {
                    t.setData({
                        giftListData: e.data.list,
                        giftMemberData: e.data.member,
                        giftType: e.data.type ? e.data.type : {},
                        showGift: !0,
                        shade: !0
                    });
                    var i = t.data.giftType;
                    i && 1 == i.integral ? t.setData({
                        activeNum: 1
                    }) : i && 1 == i.balance ? t.setData({
                        activeNum: 2
                    }) : i && 1 == i.love && t.setData({
                        activeNum: 3
                    });
                } else wx.showToast({
                    icon: "none",
                    title: e.msg,
                    duration: 1500
                });
                wx.hideLoading();
            },
            fail: function(t) {
                wx.hideLoading(), console.log(t.msg);
            }
        });
    },
    getData: function(t) {
        var e = this, o = i.getNetAddresss("plugin.room.frontend.live.room");
        i._postNetWork({
            url: o,
            showToastIn: !1,
            data: {
                id: this.data.room_id,
                password: this.data.passwordVal
            },
            success: function(i) {
                var o = i.data;
                if (1 == o.result) {
                    if (2 == o.data.purview) return wx.hideToast({}), void wx.showModal({
                        title: "提示",
                        content: "密码错误,是否重新输入密码?",
                        success: function(a) {
                            a.confirm ? (void 0 !== t && e.setData({
                                passwordIndex: t
                            }), e.setData({
                                passwordShow: !0
                            })) : a.cancel && wx.redirectTo({
                                url: "/packageD/directSeeding/liveList/liveList"
                            });
                        }
                    });
                    if (3 == o.data.purview) return wx.hideToast({}), void wx.showModal({
                        title: "提示",
                        content: "需要密码访问,是否输入密码?",
                        success: function(a) {
                            a.confirm ? (void 0 !== t && e.setData({
                                passwordIndex: t
                            }), e.setData({
                                passwordShow: !0
                            })) : a.cancel && wx.redirectTo({
                                url: "/packageD/directSeeding/liveList/liveList"
                            });
                        }
                    });
                    if (4 == o.data.purview) return wx.hideToast({}), wx.showModal({
                        title: "提示",
                        content: "没有访问权限",
                        showCancel: !1,
                        success: function(t) {
                            t.confirm && wx.redirectTo({
                                url: "/packageD/directSeeding/liveList/liveList"
                            });
                        }
                    }), void e.setData({
                        passwordShow: !1
                    });
                    if (e.setData({
                        passwordShow: !1
                    }), 4 == o.data.status) return wx.hideToast({}), void wx.showModal({
                        title: "提示",
                        content: "直播已经结束",
                        showCancel: !1,
                        success: function(t) {
                            t.confirm && (o.data && o.data.back_id ? wx.navigateTo({
                                url: "/packageD/directSeeding/livePage/livePage?id=" + e.data.room_id + "&playerType=video&backid=" + o.data.back_id
                            }) : wx.redirectTo({
                                url: "/packageD/directSeeding/liveList/liveList"
                            }));
                        }
                    });
                    if (1 == o.data.status) return wx.hideToast({}), void wx.showModal({
                        title: "提示",
                        content: "直播等待审核中，请稍后再来",
                        showCancel: !1,
                        success: function(t) {
                            t.confirm && wx.redirectTo({
                                url: "/packageD/directSeeding/liveList/liveList"
                            });
                        }
                    });
                    if (2 == o.data.status) return wx.hideToast({}), void wx.showModal({
                        title: "提示",
                        content: "等待直播中，请稍后再来",
                        showCancel: !1,
                        success: function(t) {
                            t.confirm && (this.data.code_id ? wx.redirectTo({
                                url: "/packageD/directSeeding/liveList/liveList?cd=" + this.data.code_id
                            }) : wx.redirectTo({
                                url: "/packageD/directSeeding/liveList/liveList"
                            }));
                        }
                    });
                    if (o.data.online_status && "forbid" == o.data.online_status) return wx.hideToast({}), 
                    void wx.showModal({
                        title: "提示",
                        content: "抱歉,该直播间被禁用了",
                        showCancel: !1,
                        success: function(t) {
                            t.confirm && wx.redirectTo({
                                url: "/packageD/directSeeding/liveList/liveList"
                            });
                        }
                    });
                    o.data.online_status && "inactive" == o.data.online_status && (wx.hideToast({}), 
                    wx.showModal({
                        title: "提示",
                        content: "抱歉,该主播暂时离开",
                        showCancel: !1,
                        success: function(t) {}
                    })), e.setData({
                        shownum: o.data.like_num ? o.data.like_num : 0,
                        roomData: o.data,
                        id: o.data.member_id,
                        view_num: o.data.view_num,
                        roomMemberContentArray: [],
                        roomMemberContent: [],
                        IMmessage: o.data.message,
                        luck_number: o.data.luck_number || 0,
                        close_reward: o.data.close_reward || 0,
                        close_chat: o.data.close_chat || 0,
                        mode_button: o.data.mode_button || 0
                    }), e.data.last_room_id == e.data.room_id && e.setData({
                        "liveListData[0].avatar": o.data.avatar,
                        "liveListData[0].cover": o.data.cover,
                        "liveListData[0].banner": o.data.banner
                    }), o.data.voice_status && (e.setData({
                        livePKData: o.data.voice_anchor,
                        livePKSrc: o.data.voice_anchor.play_url.play_url_rtmp,
                        isLivePK: !0
                    }), e.data.startPKTime = o.data.voice_anchor.start_time || Date.parse(new Date()) / 1e3, 
                    e.data.pkTimer = setInterval(function() {
                        e.GetRTime();
                    }, 1e3)), 1 == o.data.is_concern ? e.setData({
                        focusBol: !1
                    }) : e.setData({
                        focusBol: !0
                    }), e.activeRoomSet(), 1 == o.data.IM && setTimeout(function() {
                        e.chatLogin();
                    }, 1e3), void 0 !== t && e.setData(a({}, "liveListData[" + t + "].changeloadBol", !0));
                    for (var s = 0; s < e.data.activityTimeArray.length; s++) clearTimeout(e.data.activityTimeArray[s]);
                    if (e.data.activityTimeArray = [], 1 == o.data.view_activity) {
                        for (var c = o.data.activity, l = [], h = e.data.activityTimeArray, u = function(t) {
                            var i = c[t], o = i.coupon, s = 0;
                            if (i.liveTime && (s = 60 * i.liveTime * 1e3), i.activityList = o, i.pointBonusStatus = 1, 
                            i.loveBonusStatus = 1, i.balanceBonusStatus = 1, i.packetBonusStatus = 1, i.status = 1, 
                            i.showactivity = !1, l.push({
                                activityData: i
                            }), s) {
                                var n;
                                n = setTimeout(function() {
                                    e.setData(a({}, "activityDataArray[" + t + "].activityData.showactivity", !0));
                                }, s), h.push(n);
                            }
                        }, m = 0; m < c.length; m++) u(m);
                        e.setData({
                            activityTimeArray: h,
                            activityDataArray: l
                        });
                    }
                    clearTimeout(n), clearTimeout(r), clearTimeout(d), e.getGiftEffect();
                } else wx.showToast({
                    icon: "none",
                    title: o.msg,
                    duration: 1500
                });
            },
            fail: function(t) {
                console.log(t.msg);
            }
        });
    },
    passwordLiveBtn: function() {
        void 0 !== this.data.passwordIndex ? this.getData(this.data.passwordIndex) : this.getData(0);
    },
    goCoupon: function() {
        wx.navigateTo({
            url: "/packageA/member/coupon_v2/coupon_v2"
        });
    },
    goIntegral: function() {
        wx.navigateTo({
            url: "/packageB/member/integral/integral"
        });
    },
    goLoveindex: function() {
        wx.navigateTo({
            url: "/packageB/member/love/Love_index/Love_index"
        });
    },
    gobalance: function() {
        wx.navigateTo({
            url: "/packageA/member/balance/balance/balance"
        });
    },
    followBtn: function() {
        this.data.focusBol ? this.addConcern() : this.cancelConcern();
    },
    addConcern: function() {
        var t = this, a = i.getNetAddresss("plugin.room.frontend.live.concern");
        i._postNetWork({
            url: a,
            showToastIn: !1,
            data: {
                member_id: this.data.id,
                room_id: this.data.room_id
            },
            success: function(a) {
                var e = a.data;
                1 == e.result ? (wx.showToast({
                    icon: "none",
                    title: "关注成功!",
                    duration: 1500
                }), t.setData({
                    focusBol: !1
                }), t.newMedia(2)) : wx.showToast({
                    icon: "none",
                    title: e.msg,
                    duration: 1500
                });
            },
            fail: function(t) {
                console.log(t.msg);
            }
        });
    },
    cancelConcern: function() {
        var t = this, a = i.getNetAddresss("plugin.room.frontend.anchor.cancel-concern");
        i._postNetWork({
            url: a,
            showToastIn: !1,
            data: {
                member_id: this.data.id
            },
            success: function(a) {
                var e = a.data;
                1 == e.result ? (wx.showToast({
                    icon: "none",
                    title: "取消关注!",
                    duration: 1500
                }), t.setData({
                    focusBol: !0
                })) : wx.showToast({
                    icon: "none",
                    title: e.msg,
                    duration: 1500
                });
            },
            fail: function(t) {
                console.log(t.msg);
            }
        });
    },
    goHomePage: function() {
        wx.navigateTo({
            url: "/packageD/directSeeding/anchorDetail/anchorDetail?id=" + this.data.id
        });
    },
    goPage: function(t) {
        var a = t.currentTarget.dataset.roleid, e = t.currentTarget.dataset.shopid;
        1 == a ? wx.navigateTo({
            url: "/packageC/o2o/o2oStore/o2oStore?store_id=" + e
        }) : 2 == a ? wx.navigateTo({
            url: "/packageA/member/supplier/SupplierShop/SupplierShop?id=" + e
        }) : 3 == a ? wx.navigateTo({
            url: "/packageC/hotel/HotelHome/HotelHome?id=" + e
        }) : wx.reLaunch({
            url: "/packageG/index/index"
        });
    },
    goGood: function(t) {
        var a = t.currentTarget.dataset.id, e = this, o = i.getNetAddresss("plugin.room.frontend.live.check-goods");
        i._postNetWork({
            url: o,
            showToastIn: !1,
            data: {
                goods_id: a,
                room_id: e.data.room_id
            },
            success: function(t) {
                var i = t.data;
                1 == i.result ? (e.setData({
                    showGoodLift: !1,
                    shade: !1
                }), wx.navigateTo({
                    url: "/packageA/detail_v2/detail_v2?id=" + a + "&liveshow=1&roomid=" + e.data.room_id
                })) : wx.showToast({
                    icon: "none",
                    title: i.msg,
                    duration: 1500
                });
            },
            fail: function(t) {
                console.log(t.msg);
            }
        });
    },
    giftSelect: function(t) {
        var a = t.currentTarget.dataset.id, e = t.currentTarget.dataset.index;
        this.setData({
            giftSelectId: a
        }), this.data.giftSelectNUm = e;
    },
    rewardBtn: function() {
        this.data.activeNum || wx.showToast({
            icon: "none",
            title: "请选取礼物支付类型",
            duration: 1500
        });
        var t = this;
        if (t.data.usewechatpayBol = !1, this.data.giftSelectBol) return !1;
        if (!this.data.giftSelectId) return wx.showToast({
            icon: "none",
            title: "请先选取礼物",
            duration: 1500
        }), !1;
        if (1 == this.data.activeNum && (!this.data.giftMemberData.credit1 || this.data.giftMemberData.credit1 <= 0 || Number(this.data.giftMemberData.credit1) < Number(this.data.giftListData[this.data.giftSelectNUm].credit1_number))) return wx.showToast({
            icon: "none",
            title: this.data.giftMemberData.credit1_name ? this.data.giftMemberData.credit1_name + "不足" : "积分不足",
            duration: 1500
        }), !1;
        if (2 == this.data.activeNum && (!this.data.giftMemberData.credit2 || this.data.giftMemberData.credit2 <= 0 || Number(this.data.giftMemberData.credit2) < Number(this.data.giftListData[this.data.giftSelectNUm].credit2_number))) {
            var a = Number(this.data.giftListData[this.data.giftSelectNUm].credit2_number);
            return !a || a <= 0 ? (wx.showToast({
                icon: "none",
                title: "打赏的礼物金额价值必须大于零",
                duration: 1500
            }), !1) : (t.setData({
                giftmoney: a,
                wechatpayShow: !0,
                showGift: !1,
                shade: !1
            }), t.data.giftSelectBol = !1, !1);
        }
        if (3 == this.data.activeNum && (!this.data.giftMemberData.love || this.data.giftMemberData.love <= 0 || Number(this.data.giftMemberData.love) < Number(this.data.giftListData[this.data.giftSelectNUm].love_number))) return wx.showToast({
            icon: "none",
            title: this.data.giftMemberData.love_name ? this.data.giftMemberData.love_name + "不足" : "爱心值不足",
            duration: 1500
        }), !1;
        this.data.giftSelectBol = !0;
        var e = i.getNetAddresss("plugin.room.frontend.reward.index"), o = this.data.activeNum, s = 0;
        1 == o ? s = this.data.giftListData[this.data.giftSelectNUm].credit1_number : 2 == o ? s = this.data.giftListData[this.data.giftSelectNUm].credit2_number : 3 == o && (s = this.data.giftListData[this.data.giftSelectNUm].love_number), 
        i._postNetWork({
            url: e,
            showToastIn: !1,
            data: {
                reward_type: this.data.activeNum,
                room_id: this.data.room_id,
                reward_id: this.data.giftSelectId,
                number: s
            },
            success: function(a) {
                var e = a.data;
                1 == e.result ? (wx.showToast({
                    icon: "none",
                    title: "打赏成功",
                    duration: 1500
                }), 1 == o ? t.setData({
                    "giftMemberData.credit1": Number(t.data.giftMemberData.credit1 - s).toFixed(2)
                }) : 2 == o ? t.setData({
                    "giftMemberData.credit2": Number(t.data.giftMemberData.credit2 - s).toFixed(2)
                }) : 3 == o && t.setData({
                    "giftMemberData.love": Number(t.data.giftMemberData.love - s).toFixed(2)
                }), t.setData({
                    showGift: !1,
                    shade: !1
                })) : wx.showToast({
                    icon: "none",
                    title: e.msg,
                    duration: 1500
                }), t.data.giftSelectBol = !1;
            },
            fail: function(t) {
                console.log(t.msg);
            }
        });
    },
    giftListRoll: function() {
        this.setData({
            giftScreenLeft: -this.data.firstwidth
        }), this.giftListRoll_2();
    },
    giftListRoll_2: function() {
        var t = this;
        n = setTimeout(function() {
            t.setData({
                giftScreenLeftBol: !0
            }), t.setData({
                giftScreenLeft: t.data.giftwidth
            }), r = setTimeout(function() {
                t.setData({
                    giftScreenLeftBol: !1
                }), t.setData({
                    giftScreenLeft: -t.data.firstwidth
                }), t.data.giftListContent.length > 0 ? t.setData({
                    giftListmessage: t.data.giftListContent.shift()
                }) : t.setData({
                    giftListmessage: {}
                }), t.giftListRoll_2();
            }, 200);
        }, 6e3);
    },
    getlikeNum: function() {
        var t = this, a = i.getNetAddresss("plugin.room.frontend.live.likes");
        i._postNetWork({
            url: a,
            showToastIn: !1,
            data: {
                room_id: this.data.room_id
            },
            success: function(a) {
                1 == a.data.result && (t.setData({
                    shownum: t.data.shownum + 1
                }), t.newMedia(1));
            },
            fail: function(t) {
                console.log(t.msg);
            }
        });
    },
    clickHandler: function() {
        this.data.likeNumBol && (this.getlikeNum(), this.setData({
            likeNumBol: !1
        })), this.likeClick();
    },
    startMove: function() {
        var t = this;
        this.data.tipsContent.length > 0 && (this.data.tipsopacityBol = !this.data.tipsopacityBol), 
        setTimeout(function() {
            t.data.tipsopacityBol && t.data.tipsContent.length > 0 ? (t.setData({
                tipsContentMsssage: t.data.tipsContent.shift()
            }), t.setData({
                tipsopacity: 1
            })) : t.setData({
                tipsopacity: 0
            }), t.startMove();
        }, 2e3);
    },
    likeClick: function() {
        var t = {
            id: new Date().getTime(),
            timer: 0,
            opacity: .5,
            pathData: this.generatePathData(),
            image: "../../../image/directSeeding/zb_like_icon.png",
            factor: {
                speed: .006,
                t: 0
            }
        };
        Object.keys(s).length > 0 ? s[t.id] = t : (s[t.id] = t, this.bubbleAnimate());
    },
    getRandom: function(t, a) {
        return Math.random() * (a - t) + t;
    },
    getRandomInt: function(t, a) {
        return Math.floor(Math.random() * (a - t + 1)) + t;
    },
    generatePathData: function() {
        var t = this.data.width, a = this.data.height;
        return [ {
            x: .65 * t,
            y: a
        }, {
            x: this.getRandom(.22 * t, .33 * t),
            y: this.getRandom(.5 * a, .75 * a)
        }, {
            x: this.getRandom(0, .88 * t),
            y: this.getRandom(.25 * a, .5 * a)
        }, {
            x: this.getRandom(0, .88 * t),
            y: this.getRandom(0, .125 * a)
        } ];
    },
    updatePath: function(t, a) {
        var e = t[0], i = t[1], o = t[2], s = t[3], n = a.t, r = 3 * (i.x - e.x), d = 3 * (o.x - i.x) - r, c = s.x - e.x - r - d, l = 3 * (i.y - e.y), h = 3 * (o.y - i.y) - l, u = s.y - e.y - l - h;
        return {
            x: c * (n * n * n) + d * (n * n) + r * n + e.x,
            y: u * (n * n * n) + h * (n * n) + l * n + e.y
        };
    },
    bubbleAnimate: function() {
        var t = this, a = this.data.height;
        Object.keys(s).forEach(function(e) {
            var i = s[+e], o = t.updatePath(i.pathData, i.factor), n = o.x, r = o.y, d = i.factor.speed;
            i.factor.t += d;
            var c = 30;
            c = (a - r) / 1.5, c = Math.min(30, c);
            var h = i.opacity;
            h = r / a, h = Math.min(1, h), l.globalAlpha = h, l.drawImage(i.image, n, r, c, c), 
            i.factor.t > 1 && delete s[i.id];
        }), l.draw(), Object.keys(s).length > 0 ? c = setTimeout(function() {
            t.bubbleAnimate();
        }, 20) : (clearTimeout(c), l.draw());
    },
    liveReportBtn: function() {
        var t = this;
        this.setData({
            pauseBol: !1
        }), setTimeout(function() {
            wx.navigateTo({
                url: "/packageD/directSeeding/liveReport/liveReport?id=" + t.data.room_id
            });
        }, 500);
    },
    onReady: function() {
        var t = wx.getStorageSync("langIndex");
        this.setData({
            language: t.en
        });
    },
    onShow: function() {
        console.log("onshow:Sssssssssssssssssssssssss"), this.data.activityDataBtnBol = !1, 
        this.data.roomMemberBtnBol = !1, this.data.catMessagebol = !0, this.setData({
            pauseBol: !0
        });
    },
    onHide: function() {
        this.data.smallWindowIn ? console.log("直播在小窗，不清除定时器") : (clearInterval(this.data.rewardTimeOut), 
        this.data.rewardTimeOut = null);
    },
    onUnload: function() {
        var t = this;
        this.quitGroup(), this.quitroom(), setTimeout(function() {
            t.logout();
        }, 80), clearTimeout(0), clearTimeout(n), this.data.pkTimer && (clearInterval(this.data.pkTimer), 
        this.data.pkTimer = null);
    },
    quitroom: function() {
        var t = i.getNetAddresss("plugin.room.frontend.live.quit-room");
        i._postNetWork({
            url: t,
            showToastIn: !1,
            data: {
                room_id: this.data.room_id
            },
            success: function(t) {
                var a = t.data;
                1 != a.result && wx.showToast({
                    icon: "none",
                    title: a.msg,
                    duration: 1500
                });
            },
            fail: function(t) {
                console.log(t.msg);
            }
        });
    },
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareTimeline: function() {
        var t = wx.getStorageSync("yz_uid"), a = "", e = this.data.roomData.cover;
        if (t && (a = t), "live" == this.data.playerType) {
            var i = {
                title: "欢迎进入" + this.data.roomData.nickname + "的" + this.data.roomData.title + "直播间！",
                path: "/packageD/directSeeding/livePage/livePage?id=" + this.data.room_id + "&playerType=live&mid=" + a
            };
            return e && (i.imageUrl = e), i;
        }
        if ("video" == this.data.playerType) {
            var o = "id=" + this.data.room_id + "&playerType=video&backid=" + this.data.backid + "&mid=" + a;
            this.data.memberid && (o = "id=" + this.data.room_id + "&playerType=video&backid=" + this.data.backid + "&memberid=" + this.data.memberid + "&mid=" + a);
            var s = {
                title: "欢迎进入" + this.data.roomData.nickname + "的" + this.data.roomData.title + "直播间！",
                query: o
            };
            return e && (s.imageUrl = e), s;
        }
    },
    onShareAppMessage: function() {
        var t = wx.getStorageSync("yz_uid"), a = "", e = this.data.roomData.cover;
        if (t && (a = t), "live" == this.data.playerType) {
            var i = {
                title: "欢迎进入" + this.data.roomData.nickname + "的" + this.data.roomData.title + "直播间！",
                path: "/packageD/directSeeding/livePage/livePage?id=" + this.data.room_id + "&playerType=live&mid=" + a
            };
            return this.options.newMedia && 1 == this.options.newMedia && (i.path = i.path + "&newMedia=1"), 
            e && (i.imageUrl = e), console.log(i), i;
        }
        if ("video" == this.data.playerType) {
            var o = "/packageD/directSeeding/livePage/livePage?id=" + this.data.room_id + "&playerType=video&backid=" + this.data.backid + "&mid=" + a;
            this.data.memberid && (o = "/packageD/directSeeding/livePage/livePage?id=" + this.data.room_id + "&playerType=video&backid=" + this.data.backid + "&memberid=" + this.data.memberid + "&mid=" + a);
            var s = {
                title: "欢迎进入" + this.data.roomData.nickname + "的" + this.data.roomData.title + "直播间！",
                path: o
            };
            return this.options.newMedia && 1 == this.options.newMedia && (s.path = s.path + "&newMedia=1"), 
            e && (s.imageUrl = e), console.log(s), s;
        }
    },
    clearSend: function() {
        this.data.catMessagebol = !0, this.setData({
            inputInfo: ""
        });
    },
    sendBtn: function() {
        this.data.room_ban ? wx.showToast({
            icon: "none",
            title: "您已经被禁言",
            duration: 1500
        }) : this.data.inputInfo ? (this.setData({
            shade: !1,
            mainCommentShow: !1
        }), this.data.catMessagebol ? this.catMessage("text", this.data.inputInfo) : wx.showToast({
            icon: "none",
            title: "聊天正在发送中......",
            duration: 1500
        }), this.data.catMessagebol = !1) : (wx.showToast({
            icon: "none",
            title: "发送消息不能为空",
            duration: 1500
        }), this.setData({
            chatInputBottom: 0
        }));
    },
    catMessage: function(t, a) {
        var i = this, o = {}, s = {
            memberId: this.data.roomData.userID ? this.data.roomData.userID : "",
            nickName: this.data.roomData.userNickname ? this.cutNameLimit(this.data.roomData.userNickname) : "",
            memberAvatar: this.data.roomData.userAvatar ? this.data.roomData.userAvatar : "",
            memberLevel: this.data.roomData.member_level ? this.data.roomData.member_level : 0,
            memberLevelName: this.data.roomData.member_level_name ? this.data.roomData.member_level_name : 0,
            text: a || ""
        };
        switch (t) {
          case "text":
            o = {
                to: i.data.roomData.groupId,
                conversationType: e.default.TYPES.CONV_GROUP,
                payload: {
                    data: "自定义文本",
                    description: JSON.stringify(s),
                    extension: "customText"
                }
            };
        }
        var n = i.data.tim.createCustomMessage(o);
        i.data.tim.sendMessage(n).then(function(a) {
            if ("text" == t) {
                console.log(a);
                var e = i.data.messageList;
                e.push(s), i.setData({
                    messagesTop: 1e3 * e.length,
                    messageList: e
                }), i.clearSend(), i.newMedia(6);
            }
        }).catch(function(a) {
            "text" == t && i.clearSend(), wx.showToast({
                icon: "none",
                title: "聊天发送失败:::" + a,
                duration: 1500
            }), console.warn("sendMessage error:", a);
        });
    },
    sendmessage: function(t) {
        var a = this, i = a.data.tim.createTextMessage({
            to: a.data.roomData.groupId,
            conversationType: e.default.TYPES.CONV_GROUP,
            payload: {
                text: t
            }
        });
        a.data.tim.sendMessage(i).then(function(e) {
            console.log(e);
            var i = a.data.messageList;
            i.push({
                nick: a.data.roomData.userNickname,
                id: a.data.roomData.userID,
                text: t
            }), a.setData({
                messagesTop: 1e3 * i.length,
                messageList: i
            }), a.clearSend();
        }).catch(function(t) {
            console.warn("sendMessage error:", t), a.clearSend();
        });
    },
    cutNameLimit: function(t) {
        return t.length > 8 ? t.slice(0, 8) + "..." : t;
    },
    blurInput: function(t) {
        this.setData({
            inputInfo: t.detail.value
        });
    },
    bindfocusChatInput: function(t) {
        this.data.chatInputBottom != t.detail.height && this.setData({
            chatInputBottom: t.detail.height
        });
    },
    showUserBtn: function() {
        this.data.anchorPopupData && this.data.anchorPopupData.id && !this.data.changeAnchor ? this.setData({
            showUser: !0,
            shade: !0
        }) : this.getAnchorPopup();
    },
    showUserCloseBtn: function() {
        this.setData({
            showUser: !1,
            shade: !1
        });
    },
    showPosterBtn: function() {
        1 != this.data.roomData.is_share_word ? this.setData({
            showPoster: !0,
            shade: !0
        }) : this.setData({
            oldWord: this.data.diyPosterWord,
            showPosterWord: !0
        });
    },
    onClosePosterWord: function() {
        this.setData({
            showPosterWord: !1
        });
    },
    changePosterWord: function(t) {
        this.data.diyPosterWord = t.detail;
    },
    makePoster: function() {
        "" == this.data.diyPosterWord || this.data.oldWord != this.data.diyPosterWord ? (this.getAvaterInfo(), 
        this.setData({
            showPoster: !0,
            shade: !0
        })) : this.setData({
            showPoster: !0
        }), this.setData({
            showPosterWord: !1
        });
    },
    showPosterClose: function() {
        this.setData({
            showPoster: !1,
            shade: !1
        });
    },
    showGoodLiftBtn: function() {
        this.setData({
            showGoodLift: !0,
            shade: !0
        });
    },
    showGoodLiftCloseBtn: function() {
        this.setData({
            showGoodLift: !1,
            shade: !1
        });
    },
    showGiftCloseBtn: function() {
        this.setData({
            showGift: !1,
            shade: !1
        });
    },
    shadeClose: function() {
        this.data.showGoodLift && this.setData({
            showGoodLift: !1,
            shade: !1
        }), this.data.showGift && this.setData({
            showGift: !1,
            shade: !1
        }), this.data.mainCommentShow && (this.setData({
            mainCommentShow: !1,
            shade: !1
        }), this.clearSend());
    },
    showGiftBtn: function() {
        this.data.giftListData.length > 0 ? this.setData({
            showGift: !0,
            shade: !0
        }) : this.getGiftList();
    },
    showactivityCloseBtn: function(t) {
        var e = t.currentTarget.dataset.index;
        this.setData(a({}, "activityDataArray[" + e + "].activityData.showactivity", !1));
    },
    showactivityCloseBtn_1: function(t) {
        var e = t.currentTarget.dataset.index;
        this.setData(a({}, "roomMemberContentArray[" + e + "].activityData.showactivity", !1));
    },
    showavticeFailBtn: function() {
        this.setData({
            showavticeFail: !1,
            shade: !1
        });
    },
    mainCommentShowBtn: function() {
        this.data.imReadly || this.data.sendMessageReadly ? wx.showToast({
            icon: "none",
            title: "聊天加载中，请稍后发言",
            duration: 1500
        }) : this.data.room_ban ? wx.showToast({
            icon: "none",
            title: "您已经被禁言",
            duration: 1500
        }) : this.setData({
            mainCommentShow: !0,
            shade: !0
        });
    },
    GetRTime: function() {
        var t = this.data.startPKTime, a = (new Date().getTime() / 1e3).toFixed(0) - t, e = Math.floor(a / 60 / 60 / 24), i = Math.floor(a / 60 / 60 % 24), o = Math.floor(a / 60 % 60), s = Math.floor(a % 60);
        parseInt(e) < 10 && (e = "0" + e), parseInt(i) < 10 && (i = "0" + i), parseInt(o) < 10 && (o = "0" + o), 
        parseInt(s) < 10 && (s = "0" + s), parseInt(e) >= 1 ? this.setData({
            PKTimed: "".concat(e, ":").concat(i, ":").concat(o, ":").concat(s)
        }) : this.setData({
            PKTimed: "".concat(i, ":").concat(o, ":").concat(s)
        });
    },
    getAvaterInfo: function() {
        var t = 2 == this.data.postData.status ? "预告" : 3 == this.data.postData.status ? "直播中 " : "回放", a = wx.createCanvasContext("myCanvas");
        a.fillStyle = "#FFFFFF", a.fillRect(0, 0, this.data.canvasWidth, this.data.canvasHeight);
        var e = 56 * g * m, i = e, o = e, s = 215 * g * m, n = 23 * g * m;
        a.save(), a.beginPath(), a.arc(i / 2 + s, o / 2 + n, i / 2, 0, 2 * Math.PI, !1), 
        a.clip(), this.data.postData.shop_logo && a.drawImage(this.data.postData.shop_logo, s, n, i, o), 
        a.restore(), a.setFontSize(13 * g), a.setFillStyle("#000"), a.fillText(this.data.postData.shop_name, 296 * g * m, 60 * g * m), 
        this.drawImg(a, 560 * g * m, 440 * g * m, this.data.postData.cover, this.data.postData.imgData.width, this.data.postData.imgData.height, 30 * g * m, 98 * g * m);
        var r = 437 * g * m, d = 117 * g * m, c = 127 * g * m, l = 42 * g * m, h = 10 * g;
        a.save(), a.translate(r, d), this.drawRoundRectPath(a, c, l, h), a.fillStyle = "#ff7200", 
        a.fill(), a.restore(), a.setFillStyle("#fff"), a.setFontSize(14 * g), 2 == t.length ? a.fillText(t, 474 * g * m, 148 * g * m) : a.fillText(t, 460 * g * m, 148 * g * m);
        var u = 42 * g * m, f = u, p = u, v = 52 * g * m, w = 117 * g * m;
        a.save(), a.beginPath(), a.arc(f / 2 + v, p / 2 + w, f / 2, 0, 2 * Math.PI, !1), 
        a.clip(), a.drawImage(this.data.postData.avatar, v, w, f, p), a.restore();
        var D = this.data.postData.nickname.split(""), y = "", _ = [];
        a.setFontSize(28 * g * m), a.setFillStyle("#fff");
        for (var T = 0; T < D.length; T++) a.measureText(y).width < 160 * g ? y += D[T] : (T--, 
        _.push(y), y = "");
        if (_.push(y), _.length > 2) {
            for (var b = _.slice(0, 2), x = b[1], S = "", k = [], M = 0; M < x.length && a.measureText(S).width < 306 * g * m; M++) S += x[M];
            k.push(S);
            var L = k[0] + "...";
            b.splice(1, 1, L), _ = b;
        }
        for (var I = 0; I < _.length; I++) a.fillText(_[I], 108 * g * m, 146 * g * m + I * (28 * g * m));
        a.restore(), a.save();
        var B = this.data.postData.title.split(""), P = "", N = [];
        a.setFontSize(28 * g * m), a.setFillStyle("#333333");
        for (var A = 0; A < B.length; A++) a.measureText(P).width < 160 * g ? P += B[A] : (A--, 
        N.push(P), P = "");
        if (N.push(P), N.length > 2) {
            for (var C = N.slice(0, 2), E = C[1], R = "", O = [], W = 0; W < E.length && a.measureText(R).width < 306 * g * m; W++) R += E[W];
            O.push(R);
            var G = O[0] + "...";
            C.splice(1, 1, G), N = C;
        }
        for (var F = 0; F < N.length; F++) a.fillText(N[F], 41 * g * m, 620 * g * m + F * (28 * g * m));
        a.restore(), a.setFontSize(12 * g), a.setFillStyle("#ff7200"), a.fillText("直播时间 " + this.data.postData.live_time, 36 * g * m, 760 * g * m);
        var U = 48 * g * m, K = U, H = U, V = 35 * g * m, J = 787 * g * m;
        a.save(), a.beginPath(), a.arc(K / 2 + V, H / 2 + J, K / 2, 0, 2 * Math.PI, !1), 
        a.clip(), a.drawImage(this.data.postData.m_avatar, V, J, K, H), a.restore();
        var q = (1 == this.data.roomData.is_share_word && "" != this.data.diyPosterWord ? this.data.diyPosterWord : this.data.postData.m_nickname + "的分享").split(""), Y = "", z = [];
        a.setFontSize(28 * g * m), a.setFillStyle("#666666");
        for (var j = 0; j < q.length; j++) a.measureText(Y).width < 230 * g ? Y += q[j] : (j--, 
        z.push(Y), Y = "");
        if (z.push(Y), z.length > 2 && 1 != this.data.roomData.is_share_word) {
            for (var Q = z.slice(0, 2), X = Q[1], Z = "", $ = [], tt = 0; tt < X.length && a.measureText(Z).width < 306 * g * m; tt++) Z += X[tt];
            $.push(Z);
            var at = $[0] + "...";
            Q.splice(1, 1, at), z = Q;
        }
        for (var et = 0; et < z.length; et++) a.fillText(z[et], 94 * g * m, 820 * g * m + et * (28 * g * m));
        a.restore(), a.save(), a.drawImage(this.data.postData.qr_code, 408 * g * m, 561 * g * m, 180 * g * m, 180 * g * m), 
        a.restore(), a.setFontSize(12 * g), a.setFillStyle("#333"), a.fillText("长按保存图片", 430 * g * m, 780 * g * m), 
        a.draw(!1, this.toimage());
    },
    drawRoundRectPath: function(t, a, e, i) {
        t.beginPath(0), t.arc(a - i, e - i, i, 0, Math.PI / 2), t.lineTo(i, e), t.arc(i, e - i, i, Math.PI / 2, Math.PI), 
        t.lineTo(0, i), t.arc(i, i, i, Math.PI, 3 * Math.PI / 2), t.lineTo(a - i, 0), t.arc(a - i, i, i, 3 * Math.PI / 2, 2 * Math.PI), 
        t.lineTo(a, e - i), t.closePath();
    },
    drawImg: function(t, a, e, i, o, s, n, r) {
        console.log("cWidth", a), console.log("cHeight", e), console.log("imgWidth", o), 
        console.log("imgHeight", s);
        var d = a / o, c = e / s;
        o > a && s > e || o < a && s < e ? d > c ? t.drawImage(i, 0, (s - e / d) / 2, o, e / d, n, r, a, e) : t.drawImage(i, (o - a / c) / 2, 0, a / c, s, n, r, a, e) : o < a ? t.drawImage(i, 0, (s - e / d) / 2, o, e / d, n, r, a, e) : t.drawImage(i, (o - a / c) / 2, 0, a / c, s, n, r, a, e);
    },
    toimage: function() {
        var t = this;
        this.setData({
            showBtn: !0
        });
        var a = this;
        setTimeout(function() {
            wx.canvasToTempFilePath({
                x: 0,
                y: 0,
                width: t.data.canvasWidth,
                height: t.data.canvasHeight,
                destWidth: 4 * t.data.canvasWidth,
                destHeight: 4 * t.data.canvasHeight,
                canvasId: "myCanvas",
                success: function(t) {
                    console.log(t);
                    var e = t.tempFilePath;
                    a.setData({
                        ithumb: e,
                        loadingImg: !1
                    });
                },
                fail: function(t) {
                    console.log(t);
                }
            });
        }, 1500);
    },
    saveShareImg: function() {
        wx.showLoading({
            title: "保存中"
        }), wx.canvasToTempFilePath({
            x: 0,
            y: 0,
            width: this.data.canvasWidth,
            height: this.data.canvasHeight,
            destWidth: 4 * this.data.canvasWidth,
            destHeight: 4 * this.data.canvasHeight,
            canvasId: "myCanvas",
            success: function(t) {
                console.log(t), wx.saveImageToPhotosAlbum({
                    filePath: t.tempFilePath,
                    success: function(t) {
                        wx.showToast({
                            title: "图片保存成功",
                            icon: "success",
                            duration: 2e3
                        }), wx.hideLoading();
                    },
                    fail: function(t) {
                        wx.hideLoading();
                    }
                });
            }
        });
    },
    giftSelsectBtn: function(t) {
        var a = t.currentTarget.dataset.type;
        1 == a ? this.setData({
            activeNum: 1
        }) : 2 == a ? this.setData({
            activeNum: 2
        }) : 3 == a && this.setData({
            activeNum: 3
        });
    },
    backRightBtn: function() {
        wx.navigateBack({
            delta: 1,
            fail: function() {
                wx.navigateTo({
                    url: "/packageG/index/index"
                });
            }
        });
    },
    cloneLuckDraw: function() {
        this.setData({
            luck_number: 0
        });
    },
    gotoLuckDraw: function() {
        wx.navigateTo({
            url: "/packageH/newDraw/luckyDraw/luckyDraw"
        });
    },
    cloneADbtn: function(t) {
        var a = t.currentTarget.dataset;
        "1" == a.tag && this.setData({
            isShowADLook: !1
        }), "2" == a.tag && this.setData({
            isShowADPut: !1
        });
    },
    gotoUrl: function(t) {
        var a = t.currentTarget.dataset;
        "advertisingPutAD" != a.name ? wx.navigateTo({
            url: "/packageH/Advertising/advertisingList/advertisingList?tag=live&id=" + a.id
        }) : a.iser ? wx.navigateTo({
            url: "/packageH/Advertising/advertisingPutAD/advertisingPutAD?tag=live&id=" + a.id
        }) : wx.navigateTo({
            url: "/packageH/Advertising/advertisingApply/advertisingApply"
        });
    },
    gotoPKLiver: function(t) {
        var a = t.currentTarget.dataset;
        a.id && wx.navigateTo({
            url: "/packageD/directSeeding/livePage/livePage?id=" + a.id + "&playerType=live"
        });
    },
    giftEffectsTimer: function() {
        var t = this, a = Number(this.data.specialList[0].effect_time) > 0 ? 1e3 * Number(this.data.specialList[0].effect_time) : 2e3;
        this.data.giftEffectsTime = setTimeout(function() {
            t.data.specialList.splice(0, 1), t.setData({
                specialList: t.data.specialList
            }), t.data.specialList.length > 0 ? t.giftEffectsTimer() : clearTimeout(t.data.giftEffectsTime);
        }, a);
    },
    newMedia: function(t) {
        if (this.options.newMedia && 1 == this.options.newMedia) {
            var a = i.getNetAddresss("plugin.new-media-advertising.frontend.media-advertisingt.root-behavioral-reward");
            i._getNetWork({
                url: a,
                data: {
                    behavioral: t,
                    advertisingt_id: this.options.id
                },
                success: function(t) {}
            });
        }
    }
});